layui.use(['form', 'layer', 'laydate', 'table', 'laytpl'], function () {
    var layer = parent.layer === undefined ? layui.layer : top.layer,
        $ = layui.jquery;

    $("#backup").on('click', function () {
        layer.confirm('是否需包含下线的节点数据?', {
            btn: ['是', '否']
        }, function (index) {
            submit(0)
            layer.close(index);
        }, function (index) {
            submit(1)
            layer.close(index);
        });
    })


    function submit(data) {
        var a = document.createElement('a');
        var url = '/backup/export/' + data;
        var filename = 'data.xlsx';
        a.href = url;
        a.download = filename;
        a.click()
    }
});